import React,{Component} from "react";
import ToChild11 from './Child1的子组件'
import { glabalContext } from "./common/js/globalData";
const {Consumer} = glabalContext

class ToChild1 extends Component {
  state = {  }
  render() { 
    return (
      <div>
        子组件child1:
        {/* 读取父组件的role数据 */}
        <ToChild11/>
        <Consumer>
          {
            value => (
              <span>
                {value.email}
                <button onClick={()=>value.updateRole('wangwu')}>修改role</button>
              </span>
            )
          }
        </Consumer>
      </div>
    );
  }
}
 
export default ToChild1;